Skip to content

feat: transform core modules to standalone module functions#3857

Open
ST-DDT wants to merge 2 commits into
nextfrom
feat/standalone/core-modules
Open

feat: transform core modules to standalone module functions#3857
ST-DDT wants to merge 2 commits into
nextfrom
feat/standalone/core-modules

Conversation

@ST-DDT
Copy link
Copy Markdown
Member

@ST-DDT ST-DDT commented May 23, 2026

Split from #3748


Transforms the core modules to standalone module functions.

These core modules are interdependent and thus cannot be transformed on their own.

  • DatatypeModule
  • HelpersModule
  • NumberModule
  • StringModule

Most of the conversion steps are done automatically, but some changes have been done manually.

Please note that I renamed some util files to _, to distinguish files that export an API SMF from those that don't.

This PR can be reviewed more easily using two ways

1. Compare automated steps vs PR

#checkout PR
git reset HEAD~1 --hard
pnpm tsx scripts/temp-tranform-once.ts 
pnpm tsx scripts/generate-module-tree.ts
mv src/modules/helpers/eval.ts src/modules/helpers/_eval.ts
mv src/modules/helpers/luhn-check.ts src/modules/helpers/_luhn-check.ts 
git add .
git diff origin/feat/standalone/core-modules
#There will be quite a bit of delta
#Mostly from functions being moved to separate/different files

2. Verify no diff in modules to #3748 and look at the manual transform commits

#checkout PR
git diff origin/feat/standalone-module-functions -- src/modules/<ModuleName>
#No Diff expected

Check the individual module transform commits:


Please do not merge any PRs changing anything in the modules after this PR until all modules are transformed.

@ST-DDT ST-DDT added this to the v10.x milestone May 23, 2026
@ST-DDT ST-DDT self-assigned this May 23, 2026
@ST-DDT ST-DDT requested a review from a team as a code owner May 23, 2026 15:17
@ST-DDT ST-DDT added c: feature Request for new feature p: 1-normal Nothing urgent m: datatype Something is referring to the datatype module m: helpers Something is referring to the helpers module m: string Something is referring to the string module m: number Something is referring to the number module labels May 23, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented May 23, 2026

Deploy Preview for fakerjs ready!

Name Link
🔨 Latest commit 6b73a31
🔍 Latest deploy log https://app.netlify.com/projects/fakerjs/deploys/6a11c503b6b65d0008d43094
😎 Deploy Preview https://deploy-preview-3857.fakerjs.dev
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@ST-DDT ST-DDT requested a review from a team May 23, 2026 15:17
@codecov
Copy link
Copy Markdown

codecov Bot commented May 23, 2026

Codecov Report

❌ Patch coverage is 97.59863% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.89%. Comparing base (8c7ff0c) to head (6b73a31).

Files with missing lines Patch % Lines
src/modules/helpers/from-reg-exp.ts 94.11% 5 Missing and 2 partials ⚠️
src/modules/helpers/replace-credit-card-symbols.ts 88.00% 6 Missing ⚠️
src/modules/helpers/weighted-array-element.ts 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #3857      +/-   ##
==========================================
- Coverage   98.91%   98.89%   -0.03%     
==========================================
  Files         905      942      +37     
  Lines        3146     3247     +101     
  Branches      564      588      +24     
==========================================
+ Hits         3112     3211      +99     
- Misses         30       32       +2     
  Partials        4        4              
Files with missing lines Coverage Δ
src/modules/datatype/boolean.ts 100.00% <100.00%> (ø)
src/modules/datatype/index.ts 100.00% <100.00%> (ø)
src/modules/helpers/_eval.ts 95.65% <ø> (ø)
src/modules/helpers/_luhn-check.ts 100.00% <ø> (ø)
src/modules/helpers/array-element.ts 100.00% <100.00%> (ø)
src/modules/helpers/array-elements.ts 100.00% <100.00%> (ø)
src/modules/helpers/enum-value.ts 100.00% <100.00%> (ø)
src/modules/helpers/index.ts 100.00% <100.00%> (+4.72%) ⬆️
src/modules/helpers/maybe.ts 100.00% <100.00%> (ø)
src/modules/helpers/multiple.ts 100.00% <100.00%> (ø)
... and 35 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: feature Request for new feature m: datatype Something is referring to the datatype module m: helpers Something is referring to the helpers module m: number Something is referring to the number module m: string Something is referring to the string module p: 1-normal Nothing urgent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant